<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="${#request.getContextPath()+'/layui/css/layui.css'}">
    <style type="text/css">
        .span{
            width: 70px;
            height: 20px;
            text-align: center;
            border: 1px solid black;
        }
    </style>
</head>
<body>
<center>
     <p th:text="'用户名：'+${#request.getSession().getAttribute('user').name}"></p>
    角色:<span class="span" th:text="${role.name}"></span>
    <a 	class="layui-btn layui-btn-primary layui-border-black layui-btn-sm" th:href="${#request.getContextPath()+'/outlogin'}">注销</a>
    <p th:text="${#request.getAttribute('msg')}" style="background-color: red"></p>
    <!--乘客-->
   <div th:if="${role.id==1}">
        <form method="post"  th:action="${#request.getContextPath()+'/addOrder'}">
            <select name="id" lay-verify="required" >
                <option value="">行程</option>
                <option th:each="address:${address}" th:value="${address.id}" th:text="${address.first+'==>'+address.last+'==>总价格:'+address.costs}"></option>
            </select>
            <br>
             乘客人数:<input type="number" name="counts" class="layui-input" style="width: 20%"><br>
            <button type="submit" class="layui-btn layui-btn-primary layui-border-blue">提交</button>
        </form>

       <div th:if="${orders!=null}">
           <table class="layui-table">
               <tr>
                   <th>订单号</th>
                   <th>每个人的价格</th>
                   <th>剩余座位数</th>
               </tr>
               <tr th:each="orderss:${orders}">
                   <th th:text="${orderss.uuid}"></th>
                   <th th:text="${orderss.price}"></th>
                   <th th:text="${orderss.number}"></th>
               </tr>
           </table>
       </div>
   </div>
    <!--司机-->
    <div th:if="${role.id==2}">
        <form method="post"  th:action="${#request.getContextPath()+'/addAddress'}">
            <input name="first"  placeholder="起点" required lay-verify="required" autocomplete="off"  class="layui-input" style="width: 20%"><br>
            <input name="last"  placeholder="终点" required lay-verify="required" autocomplete="off"  class="layui-input" style="width: 20%"><br>
            <input name="costs" type="number" placeholder="价格" required lay-verify="required" autocomplete="off"  class="layui-input" style="width: 20%"  ><br>
        <button type="submit" class="layui-btn layui-btn-primary layui-border-blue">添加</button>
        </form>
        <div th:if="${orders!=null}">
            <table class="layui-table">
                <tr>
                    <th>订单号</th>
                    <th>价格</th>
                    <th>人数</th>
                </tr>
                <tr th:each="orderss:${orders}">
                    <th th:text="${orderss.uuid}"></th>
                    <th th:text="${orderss.totals}"></th>
                    <th th:text="${orderss.costs}"></th>
                </tr>
            </table>
        </div>
        <br><br><br>
        <table class="layui-table">
            <tr>
                <th>id</th>
                <th>起点</th>
                <th>终点</th>
                <th>总价格</th>
            </tr>
            <tr th:each="address:${address}">
                <th th:text="${address.id}"></th>
                <th th:text="${address.first}"></th>
                <th th:text="${address.last}"></th>
                <th th:text="${address.costs}"></th>
            </tr>
        </table>
    </div>
</center>

</body>
</html>